package de.fzi.kasma.learner.util;

import java.util.Random;

public class Util {

	public static boolean isVariable(String label) {
		return label.startsWith("?");
	}

	public static boolean isConstant(String label) {
		return !isVariable(label);
	}
	
	public static boolean isDataValue(String label) {
		return !isEntity(label);
	}
	
	public static boolean isEntity(String label) {
		return label.startsWith("http") || label.startsWith("_:") || label.startsWith("ttp://");
	}

	public static double nextDoubleInRange(double lowerBound, double upperBound) {
		if (upperBound <= lowerBound) {
			throw new IllegalArgumentException("The upper bound of the " + "random number range should be greater than the lower bound.");
		}
		return ((new Random().nextDouble() * (upperBound - lowerBound)) + lowerBound);
	}
	
	public int nextIntInRange(int lowerBound, int upperBound) {
		if (upperBound <= lowerBound) {
			throw new IllegalArgumentException("The upper bound of the " + "random number range should be greater than the lower bound.");
		}
		return new Random().nextInt(upperBound - lowerBound) + lowerBound;
	}
}
